import numpy as np
import matplotlib.pyplot as plt

# 随机大小、随机颜色的圆
n=100
x = np.random.rand(n)
y = np.random.rand(n)
color = np.random.rand(n)
logcolor = np.log10(color)
graph = plt.scatter(x,y,c=color,s=100*np.random.rand(n),cmap=plt.get_cmap('Spectral'))
cbar = plt.colorbar(graph, spacing='proportional' )
#cbar.set_ticks([0.1,0.2])
#cbar.set_ticklabels(['ha','he'])
#help(cbar)
#help(round)
#help(plt.colorbar)
plt.show()
plt.savefig("../../../doc/marp-slides/random.circles.png")
plt.cla()


exit(1)

# 标准分布
x = np.random.randn(10000)
plt.hist(x, bins=np.arange(-5,5,0.1), rwidth=0.8, density=True)
#plt.show()
plt.savefig("../../../doc/marp-slides/standard.distribution.png")
plt.cla()

# 中心极限定理：均匀分布的抽样平均服从正态分布
x = [np.average( -3 + 6*np.random.random(30) ) for x in range(10000)]
plt.hist(x, bins = np.arange(-1,1,0.03), density=True, rwidth=0.8 )
x = np.arange(-1,1,0.05); y = 1/np.sqrt(2*np.pi*0.1) * np.exp(-x*x/2/0.1)
plt.plot(x,y)
#plt.show()
plt.savefig("../../../doc/marp-slides/central.limit.theorem.png")